// 此处第二个参数vm，就是我们在页面使用的this，你可以通过vm获取vuex等操作，更多内容详见uView对拦截器的介绍部分：
// https://uviewui.com/js/http.html#%E4%BD%95%E8%B0%93%E8%AF%B7%E6%B1%82%E6%8B%A6%E6%88%AA%EF%BC%9F

// 引入分工api.js
import dApi from './divide/d-api.js'
import qApi from './divide/q-api.js'
import userApi from './divide/user-api.js'
import machineApi from './divide/machine-api.js'
import machineTaskApi from './divide/machineTask-api.js'
import projectApi from './divide/project-api.js'
import workerApi from './divide/worker-api.js'
import workerTaskApi from './divide/workerTask-api.js'

const http = uni.$u.http
// 此处使用了传入的params参数，一切自定义即可
const getApi = (data = {}, config) => http.get('/frontend/login/wechat', { params: data, ...config })
const postApi = (params = {}, config) => http.post('/frontend/yard/redeemRecord', params, config)
const getArea = (data = '', config) => {
  console.log(config, data, '122')
  return http.get('/ruoyi/city/getByPid', { params: data, ...config })
}
const getAgreement = (params = {}, config) => http.post('/frontend/agreement/getList', params, config)

let apiList = {
  ...dApi,
  ...qApi,
  ...userApi,
  ...machineApi,
  ...machineTaskApi,
  ...projectApi,
  ...workerApi,
  ...workerTaskApi,
  getArea, //获取城市接口
  getAgreement, //获取协议
  getApi, //get接口示例
  postApi, //post接口示例
}
export default { ...apiList }
